#include<iostream>
using namespace std;
int main() {
	int a, w, e, r;
	cin >> a;
	w = a % 1000;
	e = w % 100;
	r = e % 10;
	cout << a / 1000 + w / 100 + e / 10 + r;




	return 0;
}